<template>
  <el-form :inline="false" @submit.native.prevent="handleFormSubmit">
    <el-form-item>
      <el-select style="width: 100%" v-model="formData.tags" placeholder="请选择分类">
        <el-option v-for="(it, i) of attachmentTypes" :key="i" :value="it.className"></el-option>
      </el-select>
    </el-form-item>
    <el-form-item class="text-center mt40">
      <el-button @click="handleCancel">取消</el-button>
      <el-button type="primary" native-type="submit">确定</el-button>
    </el-form-item>
  </el-form>
</template>

<script>
export default {
  name: 'TagsForm',

  props: {
    formData: {
      type: Object,
      default() {
        return {}
      }
    },
    attachmentTypes: {
      type: Array,
      default() {
        return []
      }
    }
  },

  methods: {
    handleCancel() {
      this.$emit('cancel')
    },

    handleFormSubmit() {
      if (!this.formData.tags) return
      this.$emit('sure', this.formData)
    },
  }
}
</script>

<style></style>
